<?php

namespace app\common\model;

use think\Model;

class ExamList extends Model
{
    protected $table='bk_exam_list';

    //
    /**主观题分数
     * @return int
     */

    public function score(){
//dump($this);
        $sub=$this->subject_score;

        $array=explode(',',$sub);
        $sub_score=0;
        foreach ($array as $item){
            $sub_score=$sub_score+$item;
        }
        $this->score=$sub_score;
    }



    public function User(){
        return $this->belongsTo('User','uid','id');
    }
    public function Admin(){
        return $this->belongsTo('app\admin\model\Admin','admin_id','id');
    }
    public function ExamStudent(){
        return $this->hasOne('ExamStudent','exam_id','exam_id');
    }
}
